﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

using XianShang.Data;
using XianShang.Common;
using XianShang.Entity;
using XianShang.Data.DataProvider;

namespace XianShang.Data.DataProvider
{
    public class Admin
    {
        /// <summary>
        /// 檢查用戶名和密碼
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pass"></param>
        /// <returns></returns>
        public static string CheckUserAndPass(string name, string pass)
        {
            return DatabaseProvider.GetInstance().CheckUserAndPass(name,pass);
        }
        /// <summary>
        /// 取得用戶ID
        /// </summary>
        /// <returns></returns>
        public static string GetUserAccountId(string name)
        {
            return DatabaseProvider.GetInstance().GetUserAccountId(name);
        }
        /// <summary>
        /// 根據用戶名取得用戶信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetUserAccountByUserName(string name)
        {
            return DatabaseProvider.GetInstance().GetUserAccountByUserName(name);
        }
        /// <summary>
        /// 增加一個用戶
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int AddNewUser(ShortUserInfo user)
        {
            return DatabaseProvider.GetInstance().AddNewUser(user);
        }
        /// <summary>
        /// 增加一個超級用戶
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int AddNewSuperUser(ShortUserInfo user)
        {
            return DatabaseProvider.GetInstance().AddNewSuperUser(user);
        }
        /// <summary>
        /// 根據用戶ID取得用戶名信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetUserAccountInfo(string userId)
        {
            return DatabaseProvider.GetInstance().GetUserAccountInfo(userId);
        }
        /// <summary>
        /// 取得所有用戶信息
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetAllUserInfo()
        {
            return DatabaseProvider.GetInstance().GetAllUserInfo();
        }
        /// <summary>
        /// 取得所有用戶和關聯角色信息
        /// </summary>
        /// <returns></returns>
        public static DataSet GetAllUserOrRolesInfo()
        {
            return DatabaseProvider.GetInstance().GetAllUserOrRolesInfo();
        }
         /// <summary>
        /// 根據用戶ID刪除用戶
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int DelUser(string userId)
        {
            return DatabaseProvider.GetInstance().DelUser(userId);
        }
        /// <summary>
        /// 根據用戶名刪除用戶
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int DelUserByAccount(string account)
        {
            return DatabaseProvider.GetInstance().DelUserByAccount(account);
        }
        /// <summary>
        /// 根據用戶名和密碼取得用戶信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static DataSet GetUserInfoByAccountAndPass(ShortUserInfo user)
        {
            return DatabaseProvider.GetInstance().GetUserInfoByAccountAndPass(user);
        }
        /// <summary>
        /// 根據用戶ID更新用戶狀態
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int UpDateUserSysStatusById(string userId, string sts)
        {
            return DatabaseProvider.GetInstance().UpDateUserSysStatusById(userId, sts);
        }
        /// <summary>
        /// 根據用戶ID更新用戶密碼
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int UpDateUserPasswordById(string userId, string pass)
        {
            return DatabaseProvider.GetInstance().UpDateUserPasswordById(userId,pass);
        }
        /// <summary>
        /// 根據用戶名刪除用戶包括超級用戶
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int DelUserByAccountAndSuperAccount(string account)
        {
            return DatabaseProvider.GetInstance().DelUserByAccountAndSuperAccount(account);
        }
    }
}
